package com.nageoffer.jobtrain.projects.common.enums;

import lombok.Getter;
import lombok.RequiredArgsConstructor;

/**
 * 用户提交代码类型枚举类
 * author：唐晨
 */
@RequiredArgsConstructor
public enum SubmitCodeTypeEnums {
    /**
     * Java
     */
    JAVA(0),

    /**
     * CPP
     */
    CPP(1),

    /**
     * C
     */
    C(2),

    /**
     * Python
     */
    PYTHON(3),

    /**
     * Go
     */
    GO(4);

    /**
     * 根据通过代码类型获取
     *
     * @param type 代码类型
     */
    public static SubmitCodeTypeEnums getByType(Integer type) {
        for (SubmitCodeTypeEnums submitCodeTypeEnums : values()) {
            if (submitCodeTypeEnums.getType() == type) {
                return submitCodeTypeEnums;
            }
        }
        return null;
    }

    @Getter
    private final int type;
}
